package net.qiqb.usr.customer.domain;

import net.qiqbframework.modelling.domain.AggregateMapper;


public class CustomerMapper implements AggregateMapper<Customer, CustomerData> {


    @Override
    public CustomerData toData(Customer customer) {
        CustomerData data = new CustomerData();
        data.setId(customer.id);
        data.setName(customer.name);
        data.setNickName(customer.nickName);
        data.setEmail(customer.email);
        data.setEnabled(customer.enabled);
        data.setRemarks(customer.remarks);
        return data;
    }

    @Override
    public Customer toAggregateRoot(CustomerData customerData) {
        Customer customer = new Customer();
        customer.id = (customerData.getId());
        customer.name = (customerData.getName());
        customer.nickName = (customerData.getNickName());
        customer.email = (customerData.getEmail());
        customer.enabled = (customerData.isEnabled());
        customer.remarks = (customerData.getRemarks());
        return customer;
    }
}